<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/erp/css/style.css" type="text/css"/>
    <script type="text/javascript" src="/erp/js/jquery.2.1.4.js"></script>
    <script>
        jQuery(function () {
            jQuery("td[edit='edit']").dblclick(function () {
                jQuery(this).html("<input type=\"text\" style=\"background-color: aliceblue\"/>");
                jQuery(this).children().focus();
            })

        });

        function modify(gid) {
            var num = jQuery("td[edit='edit']").children().val();
            if (num) {
                jQuery.post("/erp/stockCtrl?parm=modify", {gid: gid, num: num}, function () {
                    window.location.href = "/erp/stockCtrl?parm=list";
                })
            }
        }

    </script>
</head>
<body>
<table border="1" align="center" cellspacing="0" cellpadding="0" width="100%">
    <tr>
        <th width="30%">商品名称</th>
        <th width="20%">供应商</th>
        <th width="20%">商品产地</th>
        <th width="15%">库 存</th>
        <th width="15%">操 作</th>
    </tr>
    <c:forEach items="${stocks}" var="st">
        <tr>
            <td>${st.gname}</td>
            <td>${st.merc}</td>
            <td>${st.place}</td>
            <td edit="edit" width="60px">${st.number}</td>
            <td align="center"><a class="button white" href="javascript:void(0);" onclick="modify(${st.gid});">确认</a></td>
        </tr>
    </c:forEach>
</table>
    <div align="center" style="color: midnightblue">请双击库存数量编辑</div>
</body>
</html>